package com.sponsorpay.sdk.android.publisher.mbe;

import android.app.Activity;
import android.content.Intent;
import com.sponsorpay.sdk.android.credentials.SPCredentials;
import com.sponsorpay.sdk.android.utils.SponsorPayLogger;

public class SPBrandEngageRequest
  implements SPBrandEngageClientStatusListener
{
  private static final String TAG = "SPBrandEngageRequest";
  private Activity mActivity;
  private SPBrandEngageClient mBrandEngageClient;
  private SPCredentials mCredentials;
  private SPBrandEngageRequestListener mListener;

  public SPBrandEngageRequest(SPCredentials paramSPCredentials, Activity paramActivity, SPBrandEngageClient paramSPBrandEngageClient, SPBrandEngageRequestListener paramSPBrandEngageRequestListener)
  {
    this.mCredentials = paramSPCredentials;
    this.mActivity = paramActivity;
    this.mBrandEngageClient = paramSPBrandEngageClient;
    this.mListener = paramSPBrandEngageRequestListener;
  }

  private Intent getMBEActivity()
  {
    if (this.mBrandEngageClient.canStartEngagement())
      return new Intent(this.mActivity, SPBrandEngageActivity.class);
    SponsorPayLogger.d("SPBrandEngageRequest", "Undefined error");
    return null;
  }

  public void askForOffers()
  {
    this.mBrandEngageClient.setStatusListener(this);
    this.mBrandEngageClient.requestOffers(this.mCredentials, this.mActivity);
  }

  public void didChangeStatus(SPBrandEngageClientStatusListener.SPBrandEngageClientStatus paramSPBrandEngageClientStatus)
  {
    if (paramSPBrandEngageClientStatus == SPBrandEngageClientStatusListener.SPBrandEngageClientStatus.ERROR)
      this.mListener.onSPBrandEngageError("An error happened while trying to get offers from mBE");
  }

  public void didReceiveOffers(boolean paramBoolean)
  {
    if (paramBoolean)
    {
      this.mListener.onSPBrandEngageOffersAvailable(getMBEActivity());
      return;
    }
    this.mListener.onSPBrandEngageOffersNotAvailable();
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.sponsorpay.sdk.android.publisher.mbe.SPBrandEngageRequest
 * JD-Core Version:    0.6.2
 */